package model;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import dao.GetCnn;
import entity.Khuyenmai;

public class KhuyenmaiModel {
	public List<Khuyenmai> getlistkhuyenmai(String strSearch) throws  SQLException{
		List<Khuyenmai> list = new ArrayList<Khuyenmai>();
		Connection cnn = GetCnn.getCnn();
		Statement stat = cnn.createStatement();
		ResultSet rs = stat.executeQuery(strSearch);
		while (rs.next()){
			Khuyenmai entity = new Khuyenmai();
			entity.setMakm(rs.getString("MAKM"));
			entity.setTenkm(rs.getString("TENKM"));
			entity.setNoidungkm(rs.getString("NOIDUNGKM"));
			list.add(entity);
		}
		return list;
	}

}
